<template>
  <div id="app">
    <div class="navIcon">
      <img class="navIconImg" src="http://xunpfimg.oss-cn-beijing.aliyuncs.com/img/my_banner.1237447.png">
    </div>

    <div class="counselor_div">

      <!--title-->
      <div class="counselor_name_div">
        <div class="counselor_name_title">优质房源介绍</div>
        <div class="counselor_name_bg"></div>
        <div class="counselor_name_En">Introduction to Special Rate Housing</div>
      </div>

      <div class="specialhouse_List">
        <div class="erweimaDiv">
          <img class="erweimaImg"/>
          <div class="erweimamsg">微信扫描上方二维码
            随时查看新特价房源
            进入小程序
          </div>
        </div>
        <div class="specialhouse_Item" v-for="(item,index) in data">

          <img class="spe_it_leIMg" :src="item.titlePicture"/>
          <div class="spe_it_re">
            <div class="spe_it_re_le">
              <div class="spe_it_re_le_name">{{item.premisesName}}</div>
              <div class="spe_it_re_le_con">
                {{item.featureType | replace}}
                <img class="spe_it_re_le_Img" src="../../images/speA003.png"/>
              </div>
              <div class="spe_it_re_le_con">
                {{item.orientationType}}
                <img class="spe_it_re_le_ImgT" src="../../images/speA002.png"/>
              </div>
              <div class="spe_it_re_le_con">
                {{item.houseType}}
                <img class="spe_it_re_le_Img" src="../../images/speA001.png"/>
              </div>
            </div>

            <div class="spe_it_re_r">
              <img class="spe_it_re_PerIcon" v-if="item.counselor.url=='undefined'" src="../../images/speA006.png"/>
              <img class="spe_it_re_PerIcon" v-else :src="item.counselor.url"/>
             <img class="spe_it_re_Msg" src="../../images/speA004.png"/>
              <!--<img class="spe_it_re_MsgT" src="../../images/speA005.png"/>-->
              <div class="spe_it_re_MsgT">向TA<br>咨询</div>
              <div class="spe_it_re_money">{{item.sellPrice / 1000000}}<span class="spe_it_re_money_spna">万</span></div>
              <div class="spe_it_re_moneyM">{{item.sellPrice / item.buildingArea / 100 | formatting}}元/㎡</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        data: [],
        dataT: [],
      }
    },
    computed: {},
    filters: {
      formatting(data) {
        return Math.ceil(data)
      },
      replace(data) {
        return data.replace(/,/g, ' | ')
      },
    },
    watch: {},
    methods: {
      getData() {
        let _this = this;
        let myData = {
          condition: {
            pageNum: "1",
            pageSize: "100",
          },
          house: {
            areaCode: "",
            businessType: "SALE",
            houseStatus: "2",
            houseType: "",
            priceType: "",
          }
        };
        let data = {
          data: myData
        };
        this.$server.houseList(data).then(data => {
          let mydata = data.data;

          for (var i = 0; i < mydata.length; i++) {
            mydata[i].counselor = _this.dataT[Math.floor(Math.random() * mydata.length)]
          }
          _this.data = mydata
          console.log(mydata)
        })

      },
      getDataT() {
        let _this = this;
        let myData = {
          page: "1",
          rows: "1000"
        };
        let data = {
          data: myData
        };
        this.$server.consultantList(data).then(data => {
          _this.dataT = data.data;

//          console.log(_this.data)
          _this.getData()
        })

      }
    },
    mounted() {
      let _this = this;
      _this.getDataT()
    }
  }
</script>
